import tensorflow as tf
import numpy as np

from brain import RL_NetWork


observe_shape = [(12, 12), (12, 20),(2,16)]

M = observe_shape[1][1] // 4
GROUP = observe_shape[0][1] // 4

action_size = M*GROUP + 1
DQN = RL_NetWork(name='DQN_act',observe_shape=observe_shape,action_size=action_size)

with tf.Session() as sess:
    w1 = [np.zeros(observe_shape[0], dtype=np.float32), np.ones(observe_shape[0], dtype=np.float32)]
    t1 = [np.zeros(observe_shape[1], dtype=np.float32), np.ones(observe_shape[1], dtype=np.float32)]
    g1 = [np.ones(observe_shape[2], dtype=np.float32)*0.2, -0.3*np.ones(observe_shape[2], dtype=np.float32)]
    sess.run(tf.global_variables_initializer())

    alphas1,V_,Q_ = sess.run([DQN.alphas,DQN.Value,DQN.Q_value],feed_dict={DQN.W_input:w1,DQN.T_input:t1,DQN.G_input:g1})


    summary_writer = tf.summary.FileWriter('./log/',  tf.get_default_graph())

    print(alphas1,V_,Q_,'a=',sep='\n ========\n')
    print(DQN.vars)